﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AutoduelClient.GameClient.Player
{
    public struct Coordinate
    {
        private int x;

        public int X
        {
            get { return x; }
            set { x = value; }
        }
        private int y;

        public int Y
        {
            get { return y; }
            set { y = value; }
        }

        public Coordinate(int x, int y)
        {
            this.x = x;
            this.y = y;
        }

        public override string ToString()
        {
            return "{x: " + this.x + ", y: " + this.y + "}";
        }

        public static bool operator ==(Coordinate a, Coordinate b)
        {
            return ((a.X == b.X) && (a.Y == b.Y));
        }

        public static bool operator !=(Coordinate a, Coordinate b)
        {
            return !(a == b);
        }

        public override bool Equals(object obj)
        {
            if (obj != null && obj is Coordinate)
            {
                return (this == (Coordinate)obj);
            }
            else
            {
                return false;
            }
        }

        public override int GetHashCode()
        {
            unchecked
            {       
                var result = 0;
                result = (result * 397) ^ x;
                result = (result * 397) ^ y;
                return result;
            }
        }
    }
}
